﻿
using UnityEngine;
using System.Collections;
#if UNITY_EDITOR
using UnityEditor;
#endif
namespace FrameWorkSong
{
    public class FrameWorkExamples : MonoBehaviourSimplify
    {

#if UNITY_EDITOR
        [MenuItem("FrameWorkSong/Example/1.框架示例", false, 1)]
        static void MenuClicked()
        {
            //启动项目
            EditorApplication.isPlaying = true;
            new GameObject().AddComponent<FrameWorkExamples>();
        }
#endif
        void Awake()
        {
            RegisterMsg("测试方法", Getinfo);
        }
        //IEnumerator Start()
        // {
        //     SendMsg("测试方法", "发送成功");
        //     yield return new WaitForSeconds(1.0f);
        //     UnRegisterMsg("测试方法");
        // }
        void Start()
        {
            SendMsg("测试方法", "发送成功"); ;
            //延时执行方法
            Delay(3f, () => UnRegister());
        }
        void UnRegister()
        {
            UnRegisterMsg("测试方法");
            Destroy(gameObject);
        }
         void Getinfo(object data)
        {
            Debug.Log(data);
        }
        public override void OnBeforeDestroy()
        {

        }
    }
}
